home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group03a.txt / 000048_icon-group-sender_Wed Mar 26 09:28:28 2003.msg < prev    next >
Internet Message Format  |  2003-12-22  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: (from root@localhost)
  3.     by baskerville.CS.Arizona.EDU (8.11.1/8.11.1) id h2QGSS215552
  4.     for icon-group-addresses; Wed, 26 Mar 2003 09:28:28 -0700 (MST)
  5. Message-Id: <200303261628.h2QGSS215552@baskerville.CS.Arizona.EDU>
  6. From: voice_of_reason@australia.edu (Quiet Voice)
  7. X-Newsgroups: comp.lang.icon
  8. Subject: Re: newbie questions -- ressurected
  9. Date: 26 Mar 2003 06:20:48 -0800
  10. X-Complaints-To: groups-abuse@google.com
  11. To: icon-group@cs.arizona.edu
  12. Errors-To: icon-group-errors@cs.arizona.edu
  13. Status: RO
  14.  
  15. Thank you for this response and to all who have responded directly by
  16. e:mail. The suggestions were all helpful and did solve the problem.
  17.  
  18. The next level of dilemma: I would like to sort the list.
  19.  
  20. I've tried various permutations of code using the sort() function. The
  21. errors I get seeme to be related to a type mis-match caused by the
  22. output type of sort().
  23.  
  24. Example
  25.  
  26. write(!sort(data,2)) 
  27.  
  28. {Where "data" is the external file to which the table of letters and
  29. associated values was previously written}
  30.  
  31. It has also occurred to me that the sort() function may not be giving
  32. me what I want anyway. As I recall, sort() reduces a table to a list.
  33. So I would be getting simply a list of the sorted value....not a
  34. re-oragnized table of values sorted by the associated key.
  35.  
  36. Suggestions?
  37.  
  38. Thank you!
  39.  
  40. ernobe <ernobe@yahoo.com> wrote in message news:<b5qe69$2anb2l$1@ID-82761.news.dfncis.de>...
  41. > Quiet Voice wrote:
  42. > > Greetings:
  43. > > 
  44. > > Several years ago, I made a brief foray into trying to teach myself
  45. > > the ICON programming language and develop some text analysis software.
  46. > > After several fits-n-starts, the project sort of died on the vine.
  47. > > 
  48. > > I'm back at it again. Now, I'm trying to dig thru past code, remind
  49. > > myself of what it was supposed to do and how...and shake out the
  50. > > kinks.
  51. > > 
  52. > > I ran a piece of code this morning and discovered that it results in
  53. > > an infinite loop.....but I can't figure out why.
  54. > > 
  55. > > here is the code fragment:
  56. > > 
  57. > > while not((line := read(data)) == "") do every
  58. > > write(lettercount[!line] +:= 1)
  59. > > 
  60. > > {Note, this is one continuous line in the actual code}
  61. > > "data" is an input text file
  62. > > 
  63. > > From some debugging I've done, it seems like it keep reading from the
  64. > > file after it reaches the end...it just loops back to the begining of
  65. > > the file and starts over again. But I don't figure out why.
  66. > > 
  67. > > What am I missing?
  68. > > 
  69. > According the Icon Language Reference, read( f ) "Produces the next line
  70. > from f, but fails on end of file." 
  71. >    Therefore, when the read function fails at the end of the data file,
  72. > a new assignment is not made to the line variable, the not function
  73. > succeeds once again, and an infinite loop ensues.
  74.